﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraPrinting;
using ERP_RORZE_TOOL.BizLogic;
using ERP_RORZE_TOOL.Common;

namespace ERP_RORZE.Tool.UserControls
{
    public partial class ucReports : DevExpress.XtraEditors.XtraUserControl
    {
        ReportHelper helper = new ReportHelper();
        DataTable dt = new DataTable();

        public ucReports()
        {
            InitializeComponent();
        }

        private void barBtFImportDetails_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtFImportDetails.Caption;

            uc_rpt_Tool rp = new uc_rpt_Tool(ToolConstants.Configuration.ReportName.FImportDetails);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;

            Cursor.Current = Cursors.Default;
        }

        private void barBtFMonthlyImport_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtFMonthlyImport.Caption;
            uc_rpt_Tool rp = new uc_rpt_Tool(ToolConstants.Configuration.ReportName.FMonthlyImport);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtUseDetails_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtUseDetails.Caption;
            uc_rpt_Tool rp = new uc_rpt_Tool(ToolConstants.Configuration.ReportName.FUseDetails);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtFNewOldDetails_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtFNewOldDetails.Caption;
            uc_rpt_Tool rp = new uc_rpt_Tool(ToolConstants.Configuration.ReportName.FNewOldDetails);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtFBorrowDetails_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtFBorrowDetails.Caption;
            uc_rpt_Tool rp = new uc_rpt_Tool(ToolConstants.Configuration.ReportName.FBorrowDetails);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtFTotalMachineAtFactory_BorrowAtPresent_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtFTotalMachineAtFactory_BorrowAtPresent.Caption;
            uc_rpt_Tool rp = new uc_rpt_Tool(ToolConstants.Configuration.ReportName.FTotalMachineAtFactoryBorrowAtPresent);

            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtFTotalMachineAtFactory_Crosstab_Borrow_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtFTotalMachineAtFactory_Crosstab_Borrow.Caption;

            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.FTotalMachineAtFactoryCrosstabBorrow, barBtFTotalMachineAtFactory_Crosstab_Borrow.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;

            Cursor.Current = Cursors.Default;
        }

        private void barBtFTotalMachineAtFactory_Borrow_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtFTotalMachineAtFactory_Borrow.Caption;
            uc_rpt_Tool rp = new uc_rpt_Tool(ToolConstants.Configuration.ReportName.FTotalMachineAtFactoryBorrow);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtFLossDetails_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtFLossDetails.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.FLossDetails, barBtFLossDetails.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtFTonKhoTongHop_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtFTonKhoTongHop.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.FTonKhoTongHop, barBtFTonKhoTongHop.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQTotalInstock1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtQTotalInstock1.Caption;
            uc_rpt_Tool rp = new uc_rpt_Tool(ToolConstants.Configuration.ReportName.QTotalInstock1);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQTotalInStockAtPresent_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtQTotalInStockAtPresent.Caption;
            uc_rpt_Tool rp = new uc_rpt_Tool(ToolConstants.Configuration.ReportName.QTotalInStockAtPresent);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQMonthlyInStock_Query_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //barStaticItem1.Caption = barBtQMonthlyInStock_Query.Caption;
            //gridControl1.DataSource = helper.GetAll(ToolConstants.StoreProcedure.Report.QMonthlyInStock_Query);
            //gridView1.PopulateColumns();
            //gridView1.OptionsView.ColumnAutoWidth = true;
        }

        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //barStaticItem1.Caption = barBtFMonthlyImport.Caption;
            //gridControl1.DataSource = helper.GetAll(ToolConstants.StoreProcedure.Report.FMonthlyImport);
            //gridView1.PopulateColumns();
            //gridView1.OptionsView.ColumnAutoWidth = true;
        }

        private void barBtFDailyBroken_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtFDailyBroken.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.FDailyBroken, barBtFDailyBroken.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQMonthlyBroken2_CrosstabAmount_USD_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtQMonthlyBroken2_CrosstabAmount_USD.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.QMonthlyBroken2CrosstabAmountUSD, barBtQMonthlyBroken2_CrosstabAmount_USD.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQMonthlyBroken2_CrosstabQty_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtQMonthlyBroken2_CrosstabQty.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.QMonthlyBroken2CrosstabQty, barBtQMonthlyBroken2_CrosstabQty.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQMonthlyBroken_Machine_CrosstabAmount_USD_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtQMonthlyBroken_Machine_CrosstabAmount_USD.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.QMonthlyBrokenMachineCrosstabAmountUSD, barBtQMonthlyBroken_Machine_CrosstabAmount_USD.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQMonthlyBroken_Machine_CrosstabQty_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtQMonthlyBroken_Machine_CrosstabQty.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.QMonthlyBrokenMachineCrosstabQty, barBtQMonthlyBroken_Machine_CrosstabQty.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQMonthlyBroken_Customer2_CrosstabAmount_USD_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtQMonthlyBroken_Customer2_CrosstabAmount_USD.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.QMonthlyBrokenCustomer2CrosstabAmountUSD, barBtQMonthlyBroken_Customer2_CrosstabAmount_USD.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQMonthlyBroken3_CrosstabToolGroupAmount_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtQMonthlyBroken3_CrosstabToolGroupAmount.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.QMonthlyBroken3CrosstabToolGroupAmount, barBtQMonthlyBroken3_CrosstabToolGroupAmount.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQMonthlyBroken3_Crosstab_ToolGroupQty_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtQMonthlyBroken3_Crosstab_ToolGroupQty.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.QMonthlyBroken3CrosstabToolGroupQty, barBtQMonthlyBroken3_Crosstab_ToolGroupQty.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQMonthlyBroken_Material2_CrosstabAmount_USD_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtQMonthlyBroken_Material2_CrosstabAmount_USD.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.QMonthlyBrokenMaterial2CrosstabAmountUSD, barBtQMonthlyBroken_Material2_CrosstabAmount_USD.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQMonthlyBroken_Material2_CrosstabQty_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtQMonthlyBroken_Material2_CrosstabQty.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.QMonthlyBrokenMaterial2CrosstabQty, barBtQMonthlyBroken_Material2_CrosstabQty.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQMonthlyBroken_Mistake2_CrosstabAmount_USD_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtQMonthlyBroken_Mistake2_CrosstabAmount_USD.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.QMonthlyBrokenMistake2CrosstabAmountUSD, barBtQMonthlyBroken_Mistake2_CrosstabAmount_USD.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQMonthlyBroken_Mistake2_CrosstabQty_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtQMonthlyBroken_Mistake2_CrosstabQty.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.QMonthlyBrokenMistake2CrosstabQty, barBtQMonthlyBroken_Mistake2_CrosstabQty.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQTotalMachineBroken_Crosstab_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtQTotalMachineBroken_Crosstab.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.QTotalMachineBrokenCrosstab, barBtQTotalMachineBroken_Crosstab.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtQMonthlyBroken_Customer2_CrosstabQty_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtQMonthlyBroken_Customer2_CrosstabQty.Caption;
            uc_rpt_GridView rp = new uc_rpt_GridView(ToolConstants.Configuration.ReportName.QMonthlyBrokenCustomer2CrosstabQty, barBtQMonthlyBroken_Customer2_CrosstabQty.Caption);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

        private void barBtFReturnDetails_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            barStaticItem1.Caption = barBtFReturnDetails.Caption;
            uc_rpt_Tool rp = new uc_rpt_Tool(ToolConstants.Configuration.ReportName.FReturnDetails);
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(rp);
            rp.Dock = DockStyle.Fill;
            Cursor.Current = Cursors.Default;
        }

    }
}
